package log;

import java.time.LocalDateTime;

import org.slf4j.helpers.MessageFormatter;

public class StringFormatTest {

    public static void main(String[] args) throws Exception {
        String now = LocalDateTime.now().toString();
        String str = "now time is {}";
        str = format(str, now);
        System.out.println(str);

        str = "now time is %s";
        str = String.format(str, now);
        System.out.println(str);

        str = "now time is " + now;

    }

    private static String format(String format, Object... args) {
        return MessageFormatter.arrayFormat(format, args).getMessage();
    }

}
